[QEMU] fdc: Limit sector size to 16K
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 10:09:19 +0000 (10:09 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 10:09:19 +0000 (10:09 +0000)
commitd81e62bebd4b283460026f4ef69110bac32b2eac
tree65a9032ce152117b8271a1013f4834cc6f5a2b00
parent9e4d84f0473e8639c4a5ae7a52bd3dcd6a93bd52
[QEMU] fdc: Limit sector size to 16K

In fdctrl_start_transfer the sector size field (fifo[5]) is not
checked for overflows.  This allows an arbitrarily large sector size
to be used, which can in turn result in a negative data_len field that
is then used for DMA transfers.

This can lead to the corrpuption of qemu state because some subsequent
checks on the transfer length is conducted using signed integers.

This patch limits the value fifo[5] to 7 which is the standard limit
on floppy sector size.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
tools/ioemu/hw/fdc.c